package com.example.tests;

import static org.junit.Assert.*;

import java.util.Collections;
import java.util.List;

import org.junit.*;

import com.example.model.SortedListOf;
import com.example.model.User;
import com.example.pages.InternalPage;
import com.example.pages.UsersPage;

public class severalTests extends TestBase{
  

  @Test
  public void testLogin() throws Exception {
	  InternalPage page = goToMainPage()
		    	.loginWithValidCredentials("admin", "admin");
	  
	  page.moveOnUserManagementLink();
	 // page.check
  }

  /*
  @Test
  public void testOpenExactMovie() throws Exception {
    openloginPage();
    loginPage.loginAs("admin", "admin");
    assertTrue("No such movie", movieListPage.OpenMovieByName("123"));
    logout();
  }
  
  @Test
  public void testPasswordchange(){
	  
    goToMainPage()
    	.loginWithValidCredentials("admin", "admin")
    	.gotoUserProfile()
        .changeEmailTo("admin@admin.com")
        .logout();
	//assertTrue("Not on Login Page!", loginPage.IsOnThisPage());
	//assertTrue("Not on Login Page!",driver.findElements(By.id("loginform")).size() > 0);
  }
  
  @Test
  public void testCreateNewUser(){
    UsersPage usersPage = goToMainPage()
    	.loginWithValidCredentials("admin", "admin")
    	.gotoUserManagement();
    	
    SortedListOf<User>	oldUserList = usersPage.getUsers();
    User user = new User()
    	.withName("aaaaa").withEmail("aaaa@test.com").withPassword("test");
    if (oldUserList.contains(user)){
    	usersPage.deleteUser(user);
    	oldUserList = usersPage.getUsers();
    }
    usersPage.createUser(user);
    SortedListOf<User>	newUserList = usersPage.getUsers();
    
    assertEquals(oldUserList.withAdded(user), newUserList);
    
	//assertTrue("Not on Login Page!", loginPage.IsOnThisPage());
	//assertTrue("Not on Login Page!",driver.findElements(By.id("loginform")).size() > 0);
  }
  
*/
  
}
